package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dings
 * Date: 2024-05-13
 * Time: 13:33
 */
public class AddBook implements IOperation {
    @Override
    public void work(BookList bookList) {
        int currentNum = bookList.getBookNumber();
        Scanner scanner = new Scanner(System.in);
        System.out.println("*************Add Book*************");

        System.out.println("请输入您所想增添图书的书名：");
        String name = scanner.nextLine();

        System.out.println("请输入您所想增添图书的作者：");
        String author = scanner.nextLine();

        System.out.println("请输入您所想增添图书的类型：");
        String type = scanner.nextLine();

        System.out.println("请输入您所想增添图书的价格：");
        int price = scanner.nextInt();

        Book book = new Book(name,author,type,price);
        bookList.setBooks(book,currentNum);
        bookList.setBookNumber(currentNum+1);
    }
}
